import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-07-13
 * Time:0:00
 */
public class SpiderQD {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("C:\\Users\\22954\\Desktop\\qidian.txt"));
        String regex = "<a href=\"//www\\.qidian\\.com/book/\\d{10}/\" target=\"\\w{6}\" data-eid=\"\\w{6}\" data-bid=\"\\d{10}\" title=\"[\\u4e00-\\u9fa5]+\">([\\u4e00-\\u9fa5]+)</a>";
        String line = "";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = null;
        while ((line = br.readLine()) != null) {
            matcher = pattern.matcher(line);
            if (matcher.find()) {
                System.out.println(matcher.group(1));
            }
        }
    }
}
